#!/bin/bash
#=======================
# Author : Ali Moradzade
# Created: 2022/01/12
#=======================

# returning an array value

function arraydblr {
	local origarray=($(echo "$@"))
	local newarray=($(echo "$@"))
	local elements=$[ $# - 1 ]
	for ((i = 1; i <= $elements; i++))
	{
		newarray[$i]=$[ ${origarray[$i]} * 2 ]
	}

	echo ${newarray[*]}
}

myarray=(1 2 3 4 5)
echo "The original array is: ${myarray[*]}"
arg1=$(echo ${myarray[*]})
result=($(arraydblr $arg1))
echo "The new array is: ${result[*]}"
